package com.vtc.session4;

import java.util.List;

import com.vtc.session3.Employee;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class ListViewAdapter extends ArrayAdapter<Employee>{

	

	public ListViewAdapter(Context context, int textViewResourceId,
			List<Employee> objects) {
		super(context, textViewResourceId, objects);
	}

	@Override
	public View getView(int position, View v, ViewGroup parent) {
		if(v==null){
		   TextView tvRow = new TextView(this.getContext());
		   Employee e = this.getItem(position);
		   tvRow.setText(e.getName()+">>"+e.getAge());
		   return tvRow;
		}
		else return v;
	}
}
